package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.GoodsCollection;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.MyFansOrMyConcernsQuery;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User record);

    User selectByPrimaryKey(Long id);

    List<User> selectAll();

    int updateByPrimaryKey(User record);

    User selectByEmailAndPassword(@Param("email") String email, @Param("password") String password);

    List<User> selectForList(QueryObject qo);

    void insertConcerned(@Param("concernedId")Long concernedId,@Param("userId") Long userId);
    /**
     * 通过登录用户的id查询到他所关注的所有用户id
     */
    List<Integer> selectByUserIdForConcerneds(Long userId);

    /**
     * 通过concernedId查询出他的fans数量
     * @param concernedId
     * @return
     */
    Integer selectByConcernedIdForFans(@Param("concernedId")Long concernedId);

    Integer selectByConcernedIdForConcerned(@Param("concernedId")Long concernedId);

    void deleteConcerned(@Param("userId")Long userId,@Param("concernedId")Long concernedId);

    void bindWx(@Param("openId") String openId, @Param("userId") Long userId);

    int queryByOpenId(String openId);

    User getUserInfoByOpenId(String openId);

    List<GoodsCollection> selectForGoodsCollection();

    void becomeOrLostVip(@Param("id") Long id  , @Param("vip") Boolean vip); //更改会员样式

    List<Map> selectUsersConcerned(MyFansOrMyConcernsQuery qo);


    List<Map> selectUsersFans(MyFansOrMyConcernsQuery qo);
}